Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: move to new wallpaper api #17

Merged
merged 12 commits into from
Nov 16, 2024
Merged

feat!: move to new wallpaper api #17

merged 12 commits into from
Nov 16, 2024

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Nov 15, 2024

dont try to set the wallpaper in the skill, just emit the proper event

Summary by CodeRabbit

  • New Features

    • Introduced a new method to fetch wallpapers from an external API, simplifying the wallpaper retrieval process.
    • Added a dialog response indicating the system is actively searching for pictures or images.
  • Bug Fixes

    • Removed outdated image references in documentation.
  • Refactor

    • Overhauled the wallpaper management logic, focusing on a single source for improved performance and usability.
    • Eliminated unnecessary complexity in the initialization and wallpaper change processes.
    • Removed the slideshow feature to streamline the user experience.
  • Chores

    • Updated dependency requirements for improved compatibility and functionality.

Copy link

coderabbitai bot commented Nov 15, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes in the __init__.py file involve a complete overhaul of the WallpapersSkill class, simplifying how wallpapers are fetched and managed. The initialization logic has been streamlined by removing various settings, and the update_picture method has been replaced with fetch_wallpapers, which retrieves wallpapers from a single external API. The change_wallpaper method has been simplified, and intent handler methods have been updated to call the new fetching method without success checks. Additionally, the README.md file was updated to reflect the new source of wallpapers, and the slideshow.qml file was deleted.

Changes

File Change Summary
__init__.py Overhauled WallpapersSkill class: removed settings for wallpaper sources, replaced update_picture with fetch_wallpapers, simplified change_wallpaper, and updated intent handlers.
README.md Updated text from "Pictures from selected subreddits" to "wallpapers are saved to ~/.local/share/wallpapers/" and removed reference to logo.png.
gui/qt5/slideshow.qml Deleted file containing UI component for slideshow feature.
requirements.txt Added wallpaper_finder>=0.1.1, updated ovos-utils to >=0.0.38,<1.0.0, and ovos-workshop to >=0.0.15,<3.0.0.
locale/en-us/searching_random.dialog Added string "ok, searching for (pictures

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WallpapersSkill
    User->>WallpapersSkill: Request change wallpaper
    WallpapersSkill->>WallpapersSkill: fetch_wallpapers()
    WallpapersSkill-->>User: Announce wallpaper change
Loading

🐇 "In the land of wallpapers, bright and bold,
A simpler path, a story told.
With settings gone, and checks removed,
Just change the scene, the mood improved!
So hop along, let colors play,
A rabbit's joy in every sway!" 🌈

Warning

Rate limit exceeded

@JarbasAl has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 48 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between e481018 and 8852657.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the fix label Nov 15, 2024
dont try to set the wallpaper in the skill, just emit the proper event
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 174c5f8 and 6a78e08.

📒 Files selected for processing (1)
  • __init__.py (5 hunks)
🔇 Additional comments (2)
__init__.py (2)

8-8: LGTM: Clean import and comment fix

The import of wallpaper search functions and the comment correction look good. The initialization code maintains proper settings management while removing direct wallpaper handling.

Also applies to: 20-20


233-234: LGTM: Proper PHAL integration

The implementation correctly delegates wallpaper management to PHAL by:

  1. Registering as a wallpaper provider
  2. Implementing proper message handlers
  3. Using the correct message bus events

__init__.py Show resolved Hide resolved
__init__.py Show resolved Hide resolved
@github-actions github-actions bot added fix and removed fix labels Nov 15, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
__init__.py (1)

Line range hint 165-184: Consider enhancing PHAL integration with response handling

The PHAL integration is good but could be improved by handling responses from the wallpaper manager. Consider subscribing to ovos.wallpaper.manager.set.wallpaper.response events in the register_with_PHAL method to track the success/failure of wallpaper changes.

Add this to the register_with_PHAL method:

 def register_with_PHAL(self):
     self.bus.emit(Message("ovos.wallpaper.manager.register.provider",
                           {"provider_name": self.skill_id,
                            "provider_display_name": self.name}))
     self.bus.on(f"{self.skill_id}.get.wallpaper.collection", self.handle_wallpaper_scan)
     self.bus.on(f"{self.skill_id}.get.new.wallpaper", self.handle_wallpaper_get)
+    self.bus.on("ovos.wallpaper.manager.set.wallpaper.response", self._handle_wallpaper_response)
     wallpapers = list(self.iter_wallpapers())
     self.bus.emit(Message("ovos.wallpaper.manager.collect.collection.response",
                           {"provider_name": self.skill_id,
                            "wallpaper_collection": wallpapers}))

+def _handle_wallpaper_response(self, message):
+    success = message.data.get("success", False)
+    if not success:
+        error = message.data.get("error", "unknown error")
+        self.log.error(f"Failed to set wallpaper: {error}")
+        self.speak_dialog("wallpaper.change.failed")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6a78e08 and b6572a4.

📒 Files selected for processing (1)
  • __init__.py (5 hunks)
🔇 Additional comments (1)
__init__.py (1)

8-8: LGTM: Import statement is appropriate

The import of latest_reddit from wallpaper_changer.search is correctly used throughout the code for fetching wallpapers.

@JarbasAl JarbasAl changed the title fix: delegate to phal plugin feat!: move to new wallpaper api Nov 15, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (3)
__init__.py (3)

5-5: Remove unused import

The resting_screen_handler decorator is imported but never used in the code.

-from ovos_workshop.decorators import intent_handler, resting_screen_handler
+from ovos_workshop.decorators import intent_handler
🧰 Tools
🪛 Ruff

5-5: ovos_workshop.decorators.resting_screen_handler imported but unused

(F401)


27-28: Remove unnecessary f-strings

The strings don't contain any placeholders, making the f-string prefix unnecessary.

-        self.gui.register_handler(f'wallpaper.next', self.handle_next)
-        self.gui.register_handler(f'wallpaper.prev', self.handle_prev)
+        self.gui.register_handler('wallpaper.next', self.handle_next)
+        self.gui.register_handler('wallpaper.prev', self.handle_prev)
🧰 Tools
🪛 Ruff

27-27: f-string without any placeholders

Remove extraneous f prefix

(F541)


28-28: f-string without any placeholders

Remove extraneous f prefix

(F541)


Line range hint 71-128: Add error handling for empty picture lists and index bounds

The intent handlers need proper error handling for cases where:

  1. The picture list is empty
  2. The index is out of bounds
  3. The API request fails

Example implementation for one handler (apply similar pattern to others):

     @intent_handler("wallpaper.random.intent")
     def handle_random_wallpaper(self, message):
-        image = self.fetch_wallpapers()
-        self.change_wallpaper(image)
-        self.speak_dialog("wallpaper.changed")
+        try:
+            image = self.fetch_wallpapers()
+            if not image:
+                self.speak_dialog("error.fetching.wallpaper")
+                return
+            self.change_wallpaper(image)
+            self.speak_dialog("wallpaper.changed")
+        except Exception as e:
+            LOG.exception(f"Error in handle_random_wallpaper: {str(e)}")
+            self.speak_dialog("error.fetching.wallpaper")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b6572a4 and a894bcb.

⛔ Files ignored due to path filters (1)
  • logo.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • README.md (1 hunks)
  • __init__.py (4 hunks)
  • gui/qt5/slideshow.qml (0 hunks)
  • requirements.txt (0 hunks)
💤 Files with no reviewable changes (2)
  • gui/qt5/slideshow.qml
  • requirements.txt
🧰 Additional context used
🪛 Markdownlint
README.md

3-3: null
Bare URL used

(MD034, no-bare-urls)

🪛 Ruff
__init__.py

5-5: ovos_workshop.decorators.resting_screen_handler imported but unused

(F401)


27-27: f-string without any placeholders

Remove extraneous f prefix

(F541)


28-28: f-string without any placeholders

Remove extraneous f prefix

(F541)

__init__.py Show resolved Hide resolved
__init__.py Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (4)
__init__.py (4)

11-23: Consider adding pagination and configuration support

The wallpaper fetching function could be enhanced with:

  1. Support for pagination to access more wallpapers
  2. Configurable parameters (e.g., page size, categories, NSFW filter)
  3. Settings for the skill to customize these parameters
 def get_wallpapers(query: Optional[str] = None):
     url = "https://wallhaven.cc/api/v1/search"
-    params = {"sorting": "random"}
+    params = {
+        "sorting": "random",
+        "page": "1",
+        "purity": "100",  # SFW only
+        "categories": "111",  # general/anime/people
+        "per_page": "24"
+    }
     if query:
         params["q"] = query
+    # Update params with skill settings if available
+    if hasattr(self, 'settings'):
+        params.update(self.settings.get('wallhaven_params', {}))

34-35: Remove unnecessary f-string prefixes

The string literals don't contain any interpolation, so the f-string prefix is unnecessary.

-        self.gui.register_handler(f'wallpaper.next', self.handle_next)
-        self.gui.register_handler(f'wallpaper.prev', self.handle_prev)
+        self.gui.register_handler('wallpaper.next', self.handle_next)
+        self.gui.register_handler('wallpaper.prev', self.handle_prev)
🧰 Tools
🪛 Ruff

34-34: f-string without any placeholders

Remove extraneous f prefix

(F541)


35-35: f-string without any placeholders

Remove extraneous f prefix

(F541)


Line range hint 78-135: Add error handling and user feedback in intent handlers

The intent handlers should handle cases where fetch_wallpapers returns an empty string or fails.

Example fix for one handler (apply similar pattern to others):

 @intent_handler("wallpaper.random.intent")
 def handle_random_wallpaper(self, message):
     image = self.fetch_wallpapers()
+    if not image:
+        self.speak_dialog("wallpaper.error")
+        return
     self.change_wallpaper(image)
     self.speak_dialog("wallpaper.changed")

Would you like me to:

  1. Generate the error dialog file with appropriate responses?
  2. Apply this pattern to all intent handlers?

Line range hint 106-135: Add boundary checks before accessing picture_list

The navigation handlers should verify that picture_list is not empty before attempting to access it.

 def handle_next(self, message=None):
+    if not self.picture_list:
+        self.speak_dialog("no.pictures")
+        return
     total = len(self.picture_list)
     self.pic_idx += 1
     if self.pic_idx >= total:

Apply similar checks to handle_prev and handle_set_wallpaper methods.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a894bcb and 83771d8.

📒 Files selected for processing (1)
  • __init__.py (4 hunks)
🧰 Additional context used
🪛 Ruff
__init__.py

34-34: f-string without any placeholders

Remove extraneous f prefix

(F541)


35-35: f-string without any placeholders

Remove extraneous f prefix

(F541)

__init__.py Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
__init__.py (1)

Line range hint 98-145: Consider consolidating duplicate image handling patterns

The intent handlers share similar patterns for handling images. Consider extracting common functionality into helper methods to reduce code duplication.

 class WallpapersSkill(OVOSSkill):
+    def _handle_image_display(self, image, as_wallpaper=False):
+        if as_wallpaper:
+            self.change_wallpaper(image)
+            self.speak_dialog("wallpaper.changed")
+        else:
+            self.gui.show_image(image)
+
     def handle_wallpaper_about(self, message):
         query = message.data["query"]
         self.speak_dialog("searching", {"query": query})
         image = self.fetch_wallpapers(query)
-        self.change_wallpaper(image)
-        self.speak_dialog("wallpaper.changed")
+        self._handle_image_display(image, as_wallpaper=True)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 83771d8 and 9e33ff2.

📒 Files selected for processing (1)
  • __init__.py (4 hunks)
🔇 Additional comments (5)
__init__.py (5)

44-48: LGTM! Clean initialization aligned with event-driven architecture

The initialization is well-structured with clear state tracking and PHAL registration.


50-54: Previous review comment about empty list handling still applies


Line range hint 57-78: LGTM! Well-implemented PHAL integration

The implementation properly follows the event-driven architecture for wallpaper management, with clear separation of concerns between collection management and wallpaper setting.


81-85: Previous review comment about redundant homescreen event still applies


88-97: Previous review comment about PHAL feedback handling still applies

__init__.py Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (2)
__init__.py (2)

Line range hint 45-73: Add error handling and prevent race conditions in PHAL registration

The PHAL registration methods could benefit from:

  1. Error handling for failed wallpaper fetches
  2. Preventing concurrent fetches
  3. Adding retry logic for failed registrations

Consider implementing:

 def initialize(self):
     # state trackers
     self.pic_idx = 0
     self.picture_list = []
+    self._fetch_lock = threading.Lock()
     self.register_with_PHAL()

 def register_with_PHAL(self):
+    max_retries = 3
+    retry_delay = 1
+    
+    for attempt in range(max_retries):
+        try:
             self.bus.emit(Message("ovos.wallpaper.manager.register.provider",
                                 {"provider_name": self.skill_id,
                                  "provider_display_name": self.name}))
             self.bus.on(f"{self.skill_id}.get.wallpaper.collection", 
                        self.handle_wallpaper_scan)
             self.bus.on(f"{self.skill_id}.get.new.wallpaper", 
                        self.handle_wallpaper_get)
-            self.fetch_wallpapers()
+            if not self._safe_fetch_wallpapers():
+                continue
             self.bus.emit(Message("ovos.wallpaper.manager.collect.collection.response",
                                 {"provider_name": self.skill_id,
                                  "wallpaper_collection": self.picture_list}))
+            return
+        except Exception as e:
+            LOG.error(f"PHAL registration attempt {attempt + 1} failed: {e}")
+            time.sleep(retry_delay)
+    LOG.error("Failed to register with PHAL after all retries")

+def _safe_fetch_wallpapers(self, query=None) -> Optional[str]:
+    with self._fetch_lock:
+        try:
+            return self.fetch_wallpapers(query)
+        except Exception as e:
+            LOG.error(f"Failed to fetch wallpapers: {e}")
+            return None

Line range hint 115-146: Improve state handling in slideshow navigation

The slideshow navigation handlers need:

  1. Validation of picture_list state
  2. Protection against concurrent modifications
  3. Proper bounds checking

Consider this safer implementation:

+def _validate_slideshow_state(self):
+    """Validate slideshow state and return if it's valid"""
+    if not self.picture_list:
+        self.speak_dialog("no.pictures.available")
+        return False
+    if not 0 <= self.pic_idx < len(self.picture_list):
+        self.pic_idx = 0
+        return False
+    return True

 @intent_handler(IntentBuilder("NextPictureIntent")
                 .require("next").optionally("picture")
                 .require("SlideShow"))
 def handle_next(self, message=None):
+    with self._fetch_lock:  # Prevent concurrent modifications
+        if not self._validate_slideshow_state():
+            return
         total = len(self.picture_list)
         self.pic_idx += 1
         if self.pic_idx >= total:
             self.pic_idx = total - 1
             self.speak_dialog("no.more.pictures")
         else:
             image = self.picture_list[self.pic_idx]
             self.gui.show_image(image)

 @intent_handler(IntentBuilder("PrevPictureIntent")
                 .require("previous").optionally("picture")
                 .require("SlideShow"))
 def handle_prev(self, message=None):
+    with self._fetch_lock:  # Prevent concurrent modifications
+        if not self._validate_slideshow_state():
+            return
         self.pic_idx -= 1
         if self.pic_idx < 0:
             self.pic_idx = 0
             self.speak_dialog("no.more.pictures")
         else:
             image = self.picture_list[self.pic_idx]
             self.gui.show_image(image)

 @intent_handler(IntentBuilder("MakeWallpaperIntent")
                 .require("set").require("wallpapers")
                 .optionally("picture")
                 .require("SlideShow"))
 def handle_set_wallpaper(self, message=None):
+    with self._fetch_lock:  # Prevent concurrent modifications
+        if not self._validate_slideshow_state():
+            return
         image = self.picture_list[self.pic_idx]
         self.change_wallpaper(image)
         self.speak_dialog("wallpaper.changed")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9e33ff2 and a54c2dd.

📒 Files selected for processing (1)
  • __init__.py (4 hunks)

__init__.py Outdated Show resolved Hide resolved
__init__.py Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (4)
README.md (2)

3-3: Format the URL as a proper markdown link

Convert the bare URL to a proper markdown link for better accessibility.

-Wallpapers from https://wallhaven.cc
+Wallpapers from [wallhaven.cc](https://wallhaven.cc)
🧰 Tools
🪛 Markdownlint

3-3: null
Bare URL used

(MD034, no-bare-urls)


5-5: Enhance documentation with architectural details

The documentation should reflect the new event-driven approach mentioned in the PR objectives. Consider adding information about how the wallpaper changes are handled through events.

-> wallpapers are saved to `~/.local/share/wallpapers/`
+> Wallpapers are downloaded to `~/.local/share/wallpapers/` and changes are handled through system events for better integration with the desktop environment.
__init__.py (2)

13-41: Optimize HTTP requests by reusing sessions

The function creates a new connection for each request. For better performance and to avoid connection overhead, consider using a session object:

+from requests.sessions import Session
+
+_session: Optional[Session] = None
+
+def _get_session() -> Session:
+    global _session
+    if _session is None:
+        _session = Session()
+    return _session
+
 def get_wallpapers(query: Optional[str] = None,
                    cache=True, max_pics: int = 5):
     url = "https://wallhaven.cc/api/v1/search"
     params = {"sorting": "random",
               "categories": "100"}
     if query:
         params["q"] = query
     try:
-        response = requests.get(url, params=params, timeout=10)
+        response = _get_session().get(url, params=params, timeout=10)
         response.raise_for_status()
         data = response.json()["data"]
     except (requests.RequestException, KeyError, ValueError) as e:
         LOG.error(f"Error fetching wallpapers: {str(e)}")
         return []
     urls = [w["path"] for w in data][:max_pics]
     if cache:
         paths = []
         local_wallpaper_storage = os.path.abspath(os.path.join(xdg_data_home(), "wallpapers"))
         os.makedirs(local_wallpaper_storage, exist_ok=True)
         for u in urls:
             LOG.debug(f"Downloading wallpaper: {u}")
-            pic = requests.get(u).content
+            pic = _get_session().get(u, timeout=10).content

92-95: Standardize dialog usage across intent handlers

The intent handlers have inconsistent dialog patterns. Some use "searching_random" while others use "searching". Standardize the dialog usage:

 def handle_random_wallpaper(self, message):
-    self.speak_dialog("searching_random")
+    self.speak_dialog("searching", {"query": "random"})
     image = self.fetch_wallpapers()
     self.change_wallpaper(image)
     self.speak_dialog("wallpaper.changed")

 def handle_random_picture(self, message=None):
-    self.speak_dialog("searching_random")
+    self.speak_dialog("searching", {"query": "random"})
     image = self.fetch_wallpapers()
     self.gui.show_image(image)

Also applies to: 99-101, 107-109, 115-116

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a54c2dd and e481018.

📒 Files selected for processing (3)
  • README.md (1 hunks)
  • __init__.py (4 hunks)
  • locale/en-us/searching_random.dialog (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • locale/en-us/searching_random.dialog
🧰 Additional context used
🪛 Markdownlint
README.md

3-3: null
Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (1)
README.md (1)

Line range hint 12-17: Verify examples compatibility

Let's verify that these voice commands are still valid with the new implementation.

✅ Verification successful

Let me gather more specific information about the intent handlers and their implementation.


Let me check the intent files to see how these commands are mapped.


All example commands in README.md are supported by the implementation

Based on the intent files and handlers found in the codebase:

  • "new wallpaper" matches wallpaper.random.intent pattern "(change|random|new) (current|homescreen|the|) (wallpaper|wall paper)"
  • "change wallpaper to nature" matches wallpaper.about.intent pattern "(change|random|new) (wallpaper|wall paper) (about|for|with|to) {query}"
  • "show me a picture" matches picture.random.intent pattern "(show|display) me a (picture|photo|image)"
  • "show me a picture with dogs" matches picture.about.intent pattern "(show|display) me a (picture|photo|image) (about|for|with) {query}"
  • "make that my wallpaper" is handled by MakeWallpaperIntent which requires "set" and "wallpapers" keywords (implemented in the vocab files)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for the intent handlers corresponding to these example commands
# in the Python files to ensure they're still supported

# Look for intent handlers that would handle these commands
rg -l "intent_handler|intent_file" --type py

# Search for specific keywords from the examples to ensure they're handled
rg -i "new wallpaper|change wallpaper|show.*picture|make.*wallpaper" --type py

Length of output: 280


Script:

#!/bin/bash
# Get the full context of the intent handlers and their implementation
rg -A 10 "intent_handler" __init__.py

# Also search for any vocab files that might define these intents
fd -e voc -e vocab

Length of output: 10098


Script:

#!/bin/bash
# Check the intent files that map to the handlers
fd -e intent
cat locale/en-us/*.intent 2>/dev/null

Length of output: 1129

🧰 Tools
🪛 Markdownlint

3-3: null
Bare URL used

(MD034, no-bare-urls)


1-1: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


7-7: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


8-8: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

__init__.py Show resolved Hide resolved
__init__.py Show resolved Hide resolved
@JarbasAl JarbasAl merged commit 59d09d0 into dev Nov 16, 2024
2 of 4 checks passed
@JarbasAl JarbasAl deleted the fix_plugin_compat branch November 16, 2024 13:37
@coderabbitai coderabbitai bot mentioned this pull request Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant